package com.cy.store.controller;

import com.cy.store.domain.Order;
import com.cy.store.service.IOrderService;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 * @version 1.0
 * @description: TODO
 * @date 2025/3/2 18:45
 */
@RestController
@RequestMapping("orders")
public class OrderController extends BaseController{
    @Autowired
    private  IOrderService orderService;
    @RequestMapping("create_order")
    public JsonResult<Order> createOrder(Integer aid, Integer[] cids, HttpSession session) {
       Order order = orderService.createOrder(
               aid,
               cids,
               getUidFromSession(session),
               getUsernameFromSession(session));
        return new JsonResult<>(OK,order);
    }

}
